Omplus.base.define(Omplus.controllers.Controller, {
    omplusName:"playersController"
});


/**
 * ******************************************************************
 * Player Search
 * *****************************************************************
 */

Omplus.base.define(Omplus.models.Model, {
    omplusName:"PlayerSearch",
    controller:"playersController",
    value:{
        "player_id":{
            omplusType:"Number"
        },
        "email":{
            omplusType:"String"
        },
        "name":{
            omplusType:"String"
        },
        "nick_name":{
            omplusType:"String"
        },
        "last_name":{
            omplusType:"String"
        },
        "country":{
            omplusType:"String",
            synchroniseWith:"Countries.forPlayers.code"
        },
        "city":{
            omplusType:"String"
        },
        "date_of_birth_from":{
            omplusType:"DateTime"
        },
        "date_of_birth_to":{
            omplusType:"DateTime"
        },
        "ip":{
            omplusType:"String"
        },
        "isBanned":{
            omplusType:"Boolean"
        },
        "isActive":{
            omplusType:"Boolean"
        },
        delta:{
            omplusType:"Number",
            value:5
        },
        start:{
            omplusType:"Number",
            value:0
        }
    }
});

Omplus.models.PlayerSearchModelProto = Omplus.base.extend(Omplus.models.Object, {
    omplusType:"PlayerSearchModelProto",
    value:{
        "player_id":{
            omplusType:"Number"
        },
        "nick_name":{
            omplusType:"String"
        },
        "email":{
            omplusType:"String"
        },
        "name":{
            omplusType:"String"
        },
        "last_name":{
            omplusType:"String"
        }
    }
});

Omplus.base.define(Omplus.models.Model, {
    omplusName:"PlayerSearchResults",
    controller:"playersController",
    value:{
        players:{
            omplusType:"Array",
            omplusProto:"PlayerSearchModelProto"
        },
        total:{
            omplusType:"Number"
        }
    }
});

/**
 * ******************************************************************
 * End Of Player Search
 * *****************************************************************
 */

/**
 * ******************************************************************
 * Player Details
 * *****************************************************************
 */

Omplus.models.OpeningPlayerTabProto = Omplus.base.extend(Omplus.models.Model, {
    omplusType:"OpeningPlayerTabProto",
    value:{
        "player_id":{
            omplusType:"Number"
        },
        "email":{
            omplusType:"String"
        },
        "name":{
            omplusType:"String"
        },
        "nick_name":{
            omplusType:"String"
        },
        "last_name":{
            omplusType:"String"
        },
        "country":{
            omplusType:"String"
        },
        "city":{
            omplusType:"String"
        },
        "date_of_birth":{
            omplusType:"DateTime"
        },
        "ip":{
            omplusType:"String"
        },
        "isBanned":{
            omplusType:"Boolean"
        },
        "isLocked":{
            omplusType:"Boolean"
        },
        "isActive":{
            omplusType:"Boolean"
        },
        "isMale":{
            omplusType:"Boolean"
        },
        "isFemale":{
            omplusType:"Boolean"
        },
        "is_verified":{
            omplusType:"Boolean"
        },
        reason:{
            omplusType:"String"
        },
        remark:{
            omplusType:"String"
        },
        duration:{
            omplusType:"Number"
        },
        transactionResult:{
            omplusType:"Model",
            value:{
                transactions:{
                    omplusType:"Array",
                    omplusProto:"PlayerTransactionProto"
                },
                total : {
                    omplusType:"Number"
                }
            }

        },
        remarksResult:{
            omplusType:"Model",
            value:{
                remarks:{
                    omplusType:"Array",
                    omplusProto:"PlayerRemarksProto"
                },
                total : {
                    omplusType:"Number"
                }
            }

        },
        loginsResult:{
            omplusType:"Model",
            value:{
                logins:{
                    omplusType:"Array",
                    omplusProto:"PlayerLoginHistoryProto"
                },
                total : {
                    omplusType:"Number"
                }
            }

        },
        changesResult:{
            omplusType:"Model",
            value:{
                changes:{
                    omplusType:"Array",
                    omplusProto:"PlayerAccountChangesProto"
                },
                total : {
                    omplusType:"Number"
                }
            }

        },
        documentsResult:{
            omplusType:"Model",
            value:{
                documents:{
                    omplusType:"Array",
                    omplusProto:"DocumentsProto"
                },
                total : {
                    omplusType:"Number"
                }
            }

        }

    }
});

/**
 * Transactions *******************************
 */

Omplus.models.PlayerTransactionProto = Omplus.base.extend(Omplus.models.Model, {
    omplusType:"PlayerTransactionProto",
    value:{
        "transaction_status":{
            omplusType:"String",
            nullable:true
        },
        "internal_id":{
            omplusType:"String",
            nullable:true
        },
        "player_id":{
            omplusType:"Number",
            nullable:true
        },
        "transaction_type":{
            omplusType:"String",
            nullable:true
        },
        "transaction_id":{
            omplusType:"Number",
            nullable:true
        },
        "transaction_start":{
            omplusType:"DateTime",
            nullable:true
        },
        "transaction_end":{
            omplusType:"DateTime",
            nullable:true
        },
        "deposit_type_name":{
            omplusType:"String"
        }
    }
});

Omplus.base.define(Omplus.models.Model, {
    omplusName:"PlayerTransactionSearch",
    controller:"playersController",
    value:{
        "player_id":{
            omplusType:"String",
            synchroniseWith:"playerChooser.current.player_id"
        },
        date_from:{
            omplusType:"DateTime"
        },
        date_to:{
            omplusType:"DateTime"
        },
        delta:{
            omplusType:"Number",
            value:5
        },
        start:{
            omplusType:"Number",
            value:0
        }
    }
});


/**
 * Remarks ********************************************
 */



Omplus.base.define(Omplus.models.Model, {
    omplusName:"PlayerRemarksSearch",
    controller:"playersController",
    value:{
        "player_id":{
            omplusType:"String",
            synchroniseWith:"playerChooser.current.player_id"
        },
        delta:{
            omplusType:"Number",
            value:5
        },
        start:{
            omplusType:"Number",
            value:0
        }
    }
});

Omplus.models.PlayerRemarksProto = Omplus.base.extend(Omplus.models.Model, {
    omplusType:"PlayerRemarksProto",
    value:{
        player_id:{
            omplusType:"String",
            nullable:true
        },
        text:{
            omplusType:"String",
            nullable:true
        },
        posted_by:{
            omplusType:"String",
            nullable:true
        },
        date_created:{
            omplusType:"String",
            nullable:true
        }
    }
});

/**
 * Login History ********************************************
 */

Omplus.base.define(Omplus.models.Model, {
    omplusName:"PlayerLoginHistorySearch",
    controller:"playersController",
    value:{
        "player_id":{
            omplusType:"String",
            synchroniseWith:"playerChooser.current.player_id"
        },
        date_from:{
            omplusType:"DateTime"
        },
        date_to:{
            omplusType:"DateTime"
        },
        delta:{
            omplusType:"Number",
            value:5
        },
        start:{
            omplusType:"Number",
            value:0
        }
    }
});

Omplus.models.PlayerLoginHistoryProto = Omplus.base.extend(Omplus.models.Model, {
    omplusType:"PlayerLoginHistoryProto",
    value:{
        player_id:{
            omplusType:"String",
            nullable:true
        },
        time:{
            omplusType:"String",
            nullable:true
        },
        type:{
            omplusType:"String",
            nullable:true
        },
        ip:{
            omplusType:"String",
            nullable:true
        }
    }
});

/**
 * Account Changes ********************************************
 */

Omplus.base.define(Omplus.models.Model, {
    omplusName:"PlayerAccountChangesSearch",
    controller:"playersController",
    value:{
        "player_id":{
            omplusType:"String",
            synchroniseWith:"playerChooser.current.player_id"
        },
        date_from:{
            omplusType:"DateTime"
        },
        date_to:{
            omplusType:"DateTime"
        },
        delta:{
            omplusType:"Number",
            value:5
        },
        start:{
            omplusType:"Number",
            value:0
        }
    }
});

Omplus.models.PlayerAccountChangesProto = Omplus.base.extend(Omplus.models.Model, {
    omplusType:"PlayerAccountChangesProto",
    value:{
        "date_changed":{
            omplusType:"String",
            nullable:true
        },
        posted_by:{
            omplusType:"String",
            nullable:true
        },
        changes:{
            omplusType:"String",
            nullable:true
        },
        reason:{
            omplusType:"String",
            nullable:true
        }
    }
});

/**
 * Documents ********************************************
 */

Omplus.base.define(Omplus.models.Model, {
    omplusName:"DocumentsSearch",
    controller:"playersController",
    value:{
        "player_id":{
            omplusType:"String",
            synchroniseWith:"playerChooser.current.player_id"
        },
        date_from:{
            omplusType:"DateTime"
        },
        date_to:{
            omplusType:"DateTime"
        },
        delta:{
            omplusType:"Number",
            value:5
        },
        start:{
            omplusType:"Number",
            value:0
        }
    }
});

Omplus.models.DocumentsProto = Omplus.base.extend(Omplus.models.Model, {
    omplusType:"DocumentsProto",
    value:{
        type:{
            omplusType:"String",
            nullable:true
        },
        status:{
            omplusType:"String",
            nullable:true
        },
        date_added:{
            omplusType:"String",
            nullable:true
        },
        date_updated:{
            omplusType:"String",
            nullable:true
        }
    }
});

/**
 * *******************************************************
 */

Omplus.views.OpeningPlayerTabView = Omplus.base.extend(Omplus.views.OpeningTabView, {
    omplusType:"OpeningPlayerTabView",
    layout:{
        omplusType:"AccordionLayout"
    },
    controller:"playersController",
    components:[
        {
            omplusName:"playerDetailsFirstPanel",
            omplusType:"AccordionPanel",
            components:[
                {
                    omplusType:"Panel",
                    omplusName:"playerDetailsFieldsPanel",
                    width:"100%",
                    layout:{
                        omplusType:"HorizontalLayout",
                        width:"930px"
                    },
                    cssClasses:["boxLayout"],
                    components:[
                        {
                            //Player Id
                            model:"playerChooser.current.player_id",
                            labelModel:"Assets.list.player_id_label.localValue",
                            inputType:"Label"
                        },
                        {
                            // Nickname
                            model:"playerChooser.current.nick_name",
                            labelModel:"Assets.list.nick_name_label.localValue",
                            inputType:"Label"
                        },
                        {
                            // Email
                            model:"playerChooser.current.email",
                            labelModel:"Assets.list.email_label.localValue",
                            inputType:"Label"
                        },
                        {
                            // Name
                            model:"playerChooser.current.name",
                            labelModel:"Assets.list.name_label.localValue"
                        },
                        {
                            // Last name
                            model:"playerChooser.current.last_name",
                            labelModel:"Assets.list.last_name_label.localValue"
                        },
                        {
                            // Country
                            model:"playerChooser.current.country",
                            labelModel:"Assets.list.country_label.localValue"
                        },
                        {
                            // City
                            model:"playerChooser.current.city",
                            labelModel:"Assets.list.city_label.localValue"
                        },
                        {
                            // Ip
                            model:"playerChooser.current.ip",
                            labelModel:"Assets.list.ip_label.localValue",
                            inputType:"Label"
                        },
                        {
                            // date_of_birth
                            model:"playerChooser.current.date_of_birth",
                            labelModel:"Assets.list.dob_label.localValue",
                            inputType:"Datepicker",
                            isFrom:true
                        },
                        {
                            // Banned
                            model:"playerChooser.current.isBanned",
                            labelModel:"Assets.list.isBanned_label.localValue",
                            inputType:"CheckBox",
                            readOnly:true
                        },
                        {
                            // Locked
                            model:"playerChooser.current.isLocked",
                            labelModel:"Assets.list.isLocked_label.localValue",
                            inputType:"CheckBox",
                            readOnly:true
                        },
                        {
                            // Activated
                            model:"playerChooser.current.isActive",
                            labelModel:"Assets.list.is_activated_label.localValue",
                            inputType:"CheckBox",
                            readOnly:true
                        },
                        {
                            // Male
                            model:"playerChooser.current.isMale",
                            labelModel:"Assets.list.male_label.localValue",
                            inputType:"CheckBox",
                            readOnly:true
                        },
                        {
                            // Female
                            model:"playerChooser.current.isFemale",
                            labelModel:"Assets.list.female_label.localValue",
                            inputType:"CheckBox",
                            readOnly:true

                        },
                        {
                            // Verified
                            model:"playerChooser.current.is_verified",
                            labelModel:"Assets.list.is_verified_label.localValue",
                            inputType:"CheckBox"
                        },
                        {
                            omplusType:"Panel",
                            omplusName:"playerDetailsOverlay",
                            renderTo:"playerDetailsFirstPanel"
                        }
                    ]
                },
                {
                    omplusType:"Panel",
                    omplusName:"playerDetailsButtonsFieldsPanel",
                    width:"100%",
                    layout:{
                        omplusType:"HorizontalLayout",
                        width:"930px"
                    },
                    cssClasses:["boxLayout"],
                    components:[
                        {
                            // Save Button
                            omplusType:"Button",
                            omplusName:"SavePlayerButton",
                            model:"Assets.list.label_save_button.localValue",
                            controller:"languageController",
                            click:function () {
                                Omplus.globals.getObject("SavePlayerDialog").show();
                            }
                        },
                        {
                            // Ban Button
                            omplusType:"Button",
                            omplusName:"BanPlayerButton",
                            model:"Assets.list.label_ban_button.localValue",
                            controller:"languageController",
                            click:function () {
                                Omplus.globals.getObject("playerChooser").getAction("banPlayer").run();
                            }
                        },
                        {
                            // Lock Button
                            omplusType:"Button",
                            omplusName:"LockPlayerButton",
                            model:"Assets.list.label_lock_button.localValue",
                            controller:"languageController",
                            click:function () {
                                var val = Omplus.globals.getObject("playerChooser.current.isLocked").getValue();
                                if (val == true)
                                    Omplus.globals.getObject("UnlockDialog").show();
                                else
                                    Omplus.globals.getObject("LockDialog").show();
                            }
                        },
                        {
                            // Force Logout Button
                            omplusType:"Button",
                            omplusName:"ForceLogoutPlayerButton",
                            model:"Assets.list.label_force_logout_button.localValue",
                            controller:"languageController",
                            click:function () {
                                Omplus.globals.getObject("playerChooser").getAction("forceLogoutPlayer").run();
                            }
                        },
                        {
                            // Reset Password Button
                            omplusType:"Button",
                            omplusName:"ResetPasswordPlayerButton",
                            model:"Assets.list.label_reset_password_button.localValue",
                            controller:"languageController",
                            click:function () {
                                Omplus.globals.getObject("playerChooser").getAction("resetPasswordPlayer").run();
                            }
                        },
                        {
                            // Reset Password Button
                            omplusType:"Button",
                            omplusName:"ResetPasswordPlayerButton",
                            model:"Assets.list.reset_password_button.localValue",
                            controller:"languageController",
                            click:function () {
                                Omplus.globals.getObject("playerChooser").getAction("resendActivationLinkPlayer").run();
                            }
                        },
                        {
                            // Reset Password Button
                            omplusType:"Button",
                            omplusName:"ResendActivationLinkPlayerButton",
                            model:"Assets.list.label_resend_activation_button.localValue",
                            controller:"languageController",
                            click:function () {
                                Omplus.globals.getObject("playerChooser").getAction("resendActivationLinkPlayer").run();
                            }
                        }
                    ]
                }
            ],
            controller:"languageController",
            model:"Assets.list.player_details_label.localValue"
        },
        {
            omplusName:"playerDetailsTransactionsPanel",
            omplusType:"AccordionPanel",
            components:[
                {
                    omplusType:"SearchPanel",
                    omplusName:"transactionPlayersPanel",
                    controller:"playersController",
                    renderTo:"managements",
                    models:{
                        search:"PlayerTransactionSearch",
                        searchResult:"playerChooser.current.transactionResult",
                        searchResultList:"transactions"
                    },
                    callback:function () {
                        //Omplus.globals.getObject("playersPanel").save();
                    },
                    views:{
                        search:[
                            {
                                model:"PlayerTransactionSearch.date_from",
                                labelModel:"Assets.list.transaction_from_label.localValue",
                                inputType:"Datepicker",
                                isFrom:true
                            },
                            {
                                model:"PlayerTransactionSearch.date_to",
                                labelModel:"Assets.list.transaction_to_label.localValue",
                                inputType:"Datepicker",
                                isTo:true
                            },
                            {
                                // Per page
                                inputType:"Select",
                                model:"PerPages",
                                showModel:"number",
                                current:"forTransactionPlayers",
                                controller:"languageController",
                                labelModel:"Assets.list.label_per_page.localValue",
                                perPage:true
                            },
                            {
                                // Search button
                                inputType:"Button",
                                controller:"languageController",
                                model:"Assets.list.label_search_button.localValue",
                                cssClasses:["search-button"],
                                labelWidth:"0%",
                                inputWidth:"100%",
                                searchButton:true
                            }
                        ],
                        searchResult:[
                            {
                                labelModel:"Assets.list.status_label.localValue",
                                width:"150px",
                                omplusType:"Label",
                                model:"transaction_status"
                            },
                            {
                                labelModel:"Assets.list.internal_id_label.localValue",
                                width:"150px",
                                omplusType:"Label",
                                model:"internal_id"
                            },
                            {
                                labelModel:"Assets.list.type_label.localValue",
                                width:"100px",
                                omplusType:"Label",
                                model:"transaction_type"
                            },
                            {
                                labelModel:"Assets.list.transaction_start_label.localValue",
                                width:"200px",
                                omplusType:"Label",
                                model:"transaction_start"
                            },
                            {
                                labelModel:"Assets.list.transaction_end_label.localValue",
                                width:"200px",
                                omplusType:"Label",
                                model:"transaction_end"
                            },
                            {
                                labelModel:"Assets.list.method_label.localValue",
                                width:"100px",
                                omplusType:"Label",
                                model:"deposit_type_name"
                            }
                        ]
                    }
                }
            ],
            controller:"languageController",
            model:"Assets.list.player_transactions_label.localValue"
        },
        {
            omplusName:"playerDetailsRemarksPanel",
            omplusType:"AccordionPanel",
            components:[
                {
                    omplusType:"Panel",
                    omplusName:"PlayerLeaveRemarkPanel",
                    components:[
                        {
                            omplusType:"Button",
                            omplusName:"SaveRemarkButton",
                            controller:"languageController",
                            model:"Assets.list.label_save_button.localValue",
                            click:function () {
                                Omplus.globals.getObject("playerChooser").getAction("addRemarkForPlayer").run();
                            }
                        },
                        {
                            omplusType:"LabelInputPair",
                            omplusName:"RemarkTextArea",
                            model:"playerChooser.current.remark",
                            controller:"playersController",
                            labelModel:"Assets.list.remark_label.localValue",
                            labelController:"languageController",
                            inputType:"TextArea",
                            inputWidth:"90%",
                            labelWidth:"10%",
                            rows:"5",
                            cols:"80",
                            fixedSize:true
                        }
                    ],
                    layout:{
                        omplusType:"HorizontalLayout",
                        width:"800px"
                    }
                },
                {
                    omplusType:"SearchPanel",
                    omplusName:"remarksPlayersPanel",
                    controller:"playersController",
                    renderTo:"managements",
                    models:{
                        search:"PlayerRemarksSearch",
                        searchResult:"playerChooser.current.remarksResult",
                        searchResultList:"remarks"
                    },
                    callback:function () {
                        //Omplus.globals.getObject("playersPanel").save();
                    },
                    views:{
                        search:[
                            {
                                // Per page
                                inputType:"Select",
                                model:"PerPages",
                                showModel:"number",
                                current:"forRemarksPlayers",
                                controller:"languageController",
                                labelModel:"Assets.list.label_per_page.localValue",
                                perPage:true
                            },
                            {
                                // Search button
                                inputType:"Button",
                                controller:"languageController",
                                model:"Assets.list.label_search_button.localValue",
                                cssClasses:["search-button"],
                                labelWidth:"0%",
                                inputWidth:"100%",
                                searchButton:true
                            }
                        ],
                        searchResult:[
                            {
                                labelModel:"Assets.list.remark_label.localValue",
                                width:"500px",
                                omplusType:"Label",
                                model:"text"
                            },
                            {
                                labelModel:"Assets.list.date_added_label.localValue",
                                width:"150px",
                                omplusType:"Label",
                                model:"date_created"
                            },
                            {
                                labelModel:"Assets.list.posted_by_label.localValue",
                                width:"200px",
                                omplusType:"Label",
                                model:"posted_by"
                            }
                        ]
                    },
                    cssClasses:[
                        "player-remarks-search"
                    ]
                }
            ],
            controller:"languageController",
            model:"Assets.list.player_remarks_label.localValue"
        },
        {
            omplusName:"playerDetailsLoginHistoryPanel",
            omplusType:"AccordionPanel",
            components:[
                {
                    omplusType:"SearchPanel",
                    omplusName:"loginHistoryPlayersPanel",
                    controller:"playersController",
                    renderTo:"managements",
                    models:{
                        search:"PlayerLoginHistorySearch",
                        searchResult:"playerChooser.current.loginsResult",
                        searchResultList:"logins"
                    },
                    callback:function () {
                        //Omplus.globals.getObject("playersPanel").save();
                    },
                    views:{
                        search:[
                            {
                                model:"PlayerLoginHistorySearch.date_from",
                                labelModel:"Assets.list.date_from_label.localValue",
                                inputType:"Datepicker",
                                isFrom:true
                            },
                            {
                                model:"PlayerLoginHistorySearch.date_to",
                                labelModel:"Assets.list.date_to_label.localValue",
                                inputType:"Datepicker",
                                isTo:true
                            },
                            {
                                // Per page
                                inputType:"Select",
                                model:"PerPages",
                                showModel:"number",
                                current:"forLoginPlayers",
                                controller:"languageController",
                                labelModel:"Assets.list.label_per_page.localValue",
                                perPage:true
                            },
                            {
                                // Search button
                                inputType:"Button",
                                controller:"languageController",
                                model:"Assets.list.label_search_button.localValue",
                                cssClasses:["search-button"],
                                labelWidth:"0%",
                                inputWidth:"100%",
                                searchButton:true
                            }
                        ],
                        searchResult:[
                            {
                                labelModel:"Assets.list.player_id_label.localValue",
                                width:"100px",
                                omplusType:"Label",
                                model:"player_id"
                            },
                            {
                                labelModel:"Assets.list.time_label.localValue",
                                width:"180px",
                                omplusType:"Label",
                                model:"time"
                            },
                            {
                                labelModel:"Assets.list.type_label.localValue",
                                width:"150px",
                                omplusType:"Label",
                                model:"type"
                            },
                            {
                                labelModel:"Assets.list.ip_label.localValue",
                                width:"200px",
                                omplusType:"Label",
                                model:"ip"
                            }
                        ]
                    }
                }
            ],
            controller:"languageController",
            model:"Assets.list.player_login_history_label.localValue"
        },
        {
            omplusName:"playerDetailsAccountChangesPanel",
            omplusType:"AccordionPanel",
            components:[
                {
                    omplusType:"SearchPanel",
                    omplusName:"accountChangesPlayersPanel",
                    controller:"playersController",
                    renderTo:"managements",
                    models:{
                        search:"PlayerAccountChangesSearch",
                        searchResult:"playerChooser.current.changesResult",
                        searchResultList:"changes"
                    },
                    callback:function () {
                        //Omplus.globals.getObject("playersPanel").save();
                    },
                    views:{
                        search:[
                            {
                                model:"PlayerAccountChangesSearch.date_from",
                                labelModel:"Assets.list.date_from_label.localValue",
                                inputType:"Datepicker",
                                isFrom:true
                            },
                            {
                                model:"PlayerAccountChangesSearch.date_to",
                                labelModel:"Assets.list.date_to_label.localValue",
                                inputType:"Datepicker",
                                isTo:true
                            },
                            {
                                // Per page
                                inputType:"Select",
                                model:"PerPages",
                                showModel:"number",
                                current:"forAccountPlayers",
                                controller:"languageController",
                                labelModel:"Assets.list.label_per_page.localValue",
                                perPage:true
                            },
                            {
                                // Search button
                                inputType:"Button",
                                controller:"languageController",
                                model:"Assets.list.label_search_button.localValue",
                                cssClasses:["search-button"],
                                labelWidth:"0%",
                                inputWidth:"100%",
                                searchButton:true
                            }
                        ],
                        searchResult:[
                            {
                                labelModel:"Assets.list.status_label.localValue",
                                width:"180px",
                                omplusType:"Label",
                                model:"date_changed"
                            },
                            {
                                labelModel:"Assets.list.status_label.localValue",
                                width:"200px",
                                omplusType:"Label",
                                model:"posted_by"
                            },
                            {
                                labelModel:"Assets.list.status_label.localValue",
                                width:"280px",
                                omplusType:"Label",
                                model:"changes"
                            },
                            {
                                labelModel:"Assets.list.status_label.localValue",
                                width:"220px",
                                omplusType:"Label",
                                model:"reason"
                            }
                        ]
                    }
                }
            ],
            controller:"languageController",
            model:"Assets.list.player_account_changes_label.localValue"
        },
        {
            omplusName:"playerDetailsDocumentsPanel",
            omplusType:"AccordionPanel",
            components:[
                {
                    omplusType:"SearchPanel",
                    omplusName:"documentsPlayersPanel",
                    controller:"playersController",
                    renderTo:"managements",
                    models:{
                        search:"DocumentsSearch",
                        searchResult:"playerChooser.current.documentsResult",
                        searchResultList:"documents"
                    },
                    callback:function () {
                        //Omplus.globals.getObject("playersPanel").save();
                    },
                    views:{
                        search:[
                            {
                                model:"DocumentsSearch.date_from",
                                labelModel:"Assets.list.date_from_label.localValue",
                                inputType:"Datepicker",
                                isFrom:true
                            },
                            {
                                model:"DocumentsSearch.date_to",
                                labelModel:"Assets.list.date_to_label.localValue",
                                inputType:"Datepicker",
                                isTo:true
                            },
                            {
                                // Per page
                                inputType:"Select",
                                model:"PerPages",
                                showModel:"number",
                                current:"forTransactionPlayers",
                                controller:"languageController",
                                labelModel:"Assets.list.label_per_page.localValue",
                                perPage:true
                            },
                            {
                                // Search button
                                inputType:"Button",
                                controller:"languageController",
                                model:"Assets.list.label_search_button.localValue",
                                cssClasses:["search-button"],
                                labelWidth:"0%",
                                inputWidth:"100%",
                                searchButton:true
                            }
                        ],
                        searchResult:[
                            {
                                labelModel:"Assets.list.type_label.localValue",
                                width:"180px",
                                omplusType:"Label",
                                model:"type"
                            },
                            {
                                labelModel:"Assets.list.status_label.localValue",
                                width:"200px",
                                omplusType:"Label",
                                model:"status"
                            },
                            {
                                labelModel:"Assets.list.date_added_label.localValue",
                                width:"280px",
                                omplusType:"Label",
                                model:"date_added"
                            },
                            {
                                labelModel:"Assets.list.date_updated_label.localValue",
                                width:"220px",
                                omplusType:"Label",
                                model:"date_updated"
                            }
                        ]
                    }
                }
            ],
            controller:"languageController",
            model:"Assets.list.player_documents_label.localValue"
        }
    ]
});

Omplus.base.define(Omplus.models.SingleChooser, {
    omplusName:"playerChooser",
    controller:"playersController",
    omplusProto:"OpeningPlayerTabProto",
    actions:[
        {
            omplusType:"Get",
            omplusName:"savePlayer",
            proxy:{
                omplusType:"AjaxProxy"
            },
            requestModel:"playerChooser.current",
            responseModel:"playerChooser.current",
            start:function () {
                $("#playerDetailsOverlay").show();
            },
            callback:function () {
                $("#playerDetailsOverlay").hide();
                Omplus.globals.getObject("playersPanel").save();
            }
        },
        {
            omplusType:"Get",
            omplusName:"banPlayer",
            proxy:{
                omplusType:"AjaxProxy"
            },
            requestModel:"playerChooser.current",
            responseModel:"playerChooser.current",
            start:function () {
                $("#playerDetailsOverlay").show();
            },
            callback:function () {
                $("#playerDetailsOverlay").hide();
                Omplus.globals.getObject("playersPanel").save();
            }
        },
        {
            omplusType:"Get",
            omplusName:"addRemarkForPlayer",
            proxy:{
                omplusType:"AjaxProxy"
            },
            requestModel:"playerChooser.current",
            responseModel:"playerChooser.current",
            callback:function () {
                Omplus.globals.getObject("playerChooser.current.remark").setValue("");
                Omplus.globals.getObject("remarksPlayersPanel").getAction("searchResult").run();
            }
        },
        {
            omplusType:"Get",
            omplusName:"lockPlayer",
            proxy:{
                omplusType:"AjaxProxy"
            },
            requestModel:"playerChooser.current",
            responseModel:"playerChooser.current",
            start:function () {
                $("#playerDetailsOverlay").show();
            },
            callback:function () {
                $("#playerDetailsOverlay").hide();
                Omplus.globals.getObject("playersPanel").save();
            }
        },
        {
            omplusType:"Get",
            omplusName:"forceLogoutPlayer",
            proxy:{
                omplusType:"AjaxProxy"
            },
            requestModel:"playerChooser.current",
            responseModel:"playerChooser.current",
            start:function () {
                $("#playerDetailsOverlay").show();
            },
            callback:function () {
                $("#playerDetailsOverlay").hide();
                Omplus.globals.getObject("playersPanel").save();
            }
        },
        {
            omplusType:"Get",
            omplusName:"resetPasswordPlayer",
            proxy:{
                omplusType:"AjaxProxy"
            },
            requestModel:"playerChooser.current",
            responseModel:"playerChooser.current",
            start:function () {
                $("#playerDetailsOverlay").show();
            },
            callback:function () {
                $("#playerDetailsOverlay").hide();
                Omplus.globals.getObject("playersPanel").save();
            }
        },
        {
            omplusType:"Get",
            omplusName:"resendActivationLinkPlayer",
            proxy:{
                omplusType:"AjaxProxy"
            },
            requestModel:"playerChooser.current",
            responseModel:"playerChooser.current",
            start:function () {
                $("#playerDetailsOverlay").show();
            },
            callback:function () {
                $("#playerDetailsOverlay").hide();
                Omplus.globals.getObject("playersPanel").save();
            }
        }
    ]
});

/**
 * ******************************************************************
 * End Of Player Details
 * *****************************************************************
 */

Omplus.base.define(Omplus.views.ManagementPanel, {
    omplusName:"playersPanel",
    controller:"playersController",
    renderTo:"managements",
    models:{
        chooser:"playerChooser",
        search:"PlayerSearch",
        searchResult:"PlayerSearchResults",
        searchResultList:"players",
        forDisplay:"nick_name"
    },
    views:{
        chooser:{
            title:"Assets.list.players_label.localValue",
            components:[
                {
                    omplusName:"playerTabs",
                    omplusType:"OpeningTabPanel",
                    omplusProto:"OpeningPlayerTabView",
                    controller:"playersController",
                    model:"playerChooser",
                    showModel:"nick_name"
                }
            ]
        },
        search:[
            {
                // Player Id
                model:"PlayerSearch.player_id",
                labelModel:"Assets.list.player_id_label.localValue"
            },
            {
                // Email
                model:"PlayerSearch.email",
                labelModel:"Assets.list.email_label.localValue"
            },
            {
                // Name
                model:"PlayerSearch.name",
                labelModel:"Assets.list.name_label.localValue"
            },
            {
                // nick_name
                model:"PlayerSearch.nick_name",
                labelModel:"Assets.list.nick_name_label.localValue"
            },
            {
                //last name
                model:"PlayerSearch.last_name",
                labelModel:"Assets.list.last_name_label.localValue"
            },
            {
                // Country
                inputType:"Select",
                model:"Countries",
                showModel:"name",
                current:"forPlayers",
                labelModel:"Assets.list.country_label.localValue",
                controller:"languageController"
            },
            {
                // City
                model:"PlayerSearch.city",
                labelModel:"Assets.list.city_label.localValue"
            },
            {
                // Date of birth from
                model:"PlayerSearch.date_of_birth_from",
                labelModel:"Assets.list.dob_from_label.localValue",
                inputType:"Datepicker",
                isFrom:true
            },
            {
                // Date of birth to
                model:"PlayerSearch.date_of_birth_to",
                labelModel:"Assets.list.dob_to_label.localValue",
                inputType:"Datepicker",
                isTo:true
            },
            {
                // IP
                model:"PlayerSearch.ip",
                labelModel:"Assets.list.ip_label.localValue"
            },
            {
                // Banned
                model:"PlayerSearch.isBanned",
                labelModel:"Assets.list.isBanned_label.localValue",
                inputType:"CheckBox",
                labelWidth:"70%",
                inputWidth:"30%",
                width:"150px"
            },
            {
                // Activated
                model:"PlayerSearch.isActive",
                labelModel:"Assets.list.is_activated_label.localValue",
                inputType:"CheckBox",
                labelWidth:"70%",
                inputWidth:"30%",
                width:"150px"
            },
            {
                // Per page
                inputType:"Select",
                model:"PerPages",
                showModel:"number",
                current:"forPlayers",
                controller:"languageController",
                labelModel:"Assets.list.label_per_page.localValue",
                perPage:true
            },
            {
                // Search button
                inputType:"Button",
                controller:"languageController",
                model:"Assets.list.label_search_button.localValue",
                cssClasses:["search-button"],
                labelWidth:"0%",
                inputWidth:"100%",
                searchButton:true
            }
        ],
        searchResult:[
            {
                labelModel:"Assets.list.player_id_label.localValue",
                width:"80px",
                omplusType:"Label",
                model:"player_id"
            },
            {
                labelModel:"Assets.list.nick_name_label.localValue",
                width:"150px",
                omplusType:"Label",
                model:"nick_name"
            },
            {
                labelModel:"Assets.list.email_label.localValue",
                width:"250px",
                omplusType:"Label",
                model:"email"
            },
            {
                labelModel:"Assets.list.name_label.localValue",
                width:"100px",
                omplusType:"Label",
                model:"name"
            },
            {
                labelModel:"Assets.list.last_name_label.localValue",
                width:"100px",
                omplusType:"Label",
                model:"last_name"
            },
            {
                omplusType:"Button",
                model:"Assets.list.details_label.localValue",
                width:"250px",
                controller:"languageController",
                getDetails:true
            }
        ]
    }
});

Omplus.base.define(Omplus.views.Dialog, {
    omplusName:"SavePlayerDialog",
    width:"500px",
    height:"160px",
    components:[
        {
            omplusType:"Label",
            omplusName:"SavePlayerDialogLabel",
            model:"Assets.list.label_want_to_save.localValue",
            controller:"languageController"
        },
        {
            omplusType:"TextArea",
            omplusName:"SavePlayerDialogInput",
            model:"playerChooser.current.reason",
            controller:"playersController",
            width:"480px"
        }
    ],
    confirmClick:function () {
        Omplus.globals.getObject("playerChooser").getAction("savePlayer").run();
        Omplus.globals.getObject("SavePlayerDialog").hide();
    }
});

Omplus.base.define(Omplus.views.Dialog, {
    omplusName:"SavedPlayerDialog",
    width:"500px",
    height:"100px",
    components:[
        {
            omplusType:"Label",
            omplusName:"SavedDialogLabel",
            model:"Assets.list.label_player_saved.localValue",
            controller:"languageController",
            width:"100%"
        }
    ],
    confirmClick:function () {
        Omplus.globals.getObject("SavedPlayerDialog").hide();
    },
    cancel:false
});

Omplus.base.define(Omplus.views.Dialog, {
    omplusName:"LockDialog",
    width:"500px",
    height:"150px",
    components:[
        {
            omplusType:"Label",
            omplusName:"LockDialogLabel",
            model:"Assets.list.duration_in_days_label.localValue",
            controller:"languageController",
            width:"100%"
        },
        {
            omplusType:"TextInput",
            omplusName:"LockDialogInput",
            model:"playerChooser.current.duration",
            controller:"playersController",
            width:"480px"
        }
    ],
    confirmClick:function () {
        Omplus.globals.getObject("playerChooser").getAction("lockPlayer").run();
        Omplus.globals.getObject("LockDialog").hide();
    }
});

Omplus.base.define(Omplus.views.Dialog, {
    omplusName:"UnlockDialog",
    width:"500px",
    height:"300px",
    components:[
        {
            omplusType:"Label",
            omplusName:"UnlockDialogInput",
            model:"Assets.list.unlock_label.localValue",
            controller:"languageController"
        }
    ],
    confirmClick:function () {
        Omplus.globals.getObject("playerChooser").getAction("lockPlayer").run();
        Omplus.globals.getObject("UnlockDialog").hide();
    }
});